package shiqi.PrototypePattern.deepClone;


import java.io.IOException;

public class Test {

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Email email, copyEmail = null;

        email = new Email();

        try {
            copyEmail = (Email)email.deepClone();
        } catch (Exception e) {
            e.printStackTrace();
        }


        //复制新的对象，所以返回false
        System.out.println(email == copyEmail);
        //不复制成员变量所引用的对象，所以复制的对象的成员变量依旧指向原来所引用的对象，返回true
        System.out.println(email.getAttachment() == copyEmail.getAttachment());
    }
}
